package com.alog.storage.ui.fragment;

import android.content.Intent;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.alog.storage.R;
import com.alog.storage.utils.CommonUtil;

/**
 * 首页 -> 仓库管理
 */
public class StorageManagerFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {
    private boolean mRefresh;
    private SwipeRefreshLayout mPullDownV;

    @Override
    public View onInitView(LayoutInflater inflater, ViewGroup container) {
        View v = initView(inflater);
        if (!CommonUtil.isConnect(mContext)) {
            CommonUtil.showToast(mContext, getString(R.string.no_network));
        } else {
            loadDataStarted();
            onRefresh();
        }
        return v;
    }

    private View initView(LayoutInflater inflater) {
        View v = inflater.inflate(R.layout.storagemanager, null);
        mPullDownV = (SwipeRefreshLayout) v.findViewById(R.id.home_pulldown);
        mPullDownV.setColorSchemeColors(getResources().getColor(R.color.theme_green));
        mPullDownV.setOnRefreshListener(this);
        return v;
    }


    @Override
    public void onClick(View v) {
        Intent i = new Intent();
        switch (v.getId()) {
            case 0:
                break;
        }
    }

    @Override
    public void onRefresh() {
        mRefresh = true;
    }

}
